<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of IEnumerable (Of SurvivorPool.PickObj))" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Choose Your Selections
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Edit Your Selections</h2>
    <%=Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.")%>
    <%  If ViewData("ErrorMsg") IsNot Nothing Then%>
    <p>
        <h3>
            <font color="red">
                <%=ViewData("ErrorMsg").ToString()%>
            </font>
        </h3>
    </p>
    <% End If%>
    <%  If ViewData("Deadline") <> "" Then%>
    <p>
        <h3>
            <font color="red">
                <%=ViewData("Deadline").ToString()%>
            </font>
        </h3>
    </p>
    <%  Else%>
        
    <% Using Html.BeginForm()%>
    <fieldset>
    
        <%  If ViewData("Round") = 1 OrElse ViewData("Round") = 2 Then
                Response.Write("<legend>Choose your teams:</legend>")
            Else
                Response.Write("<legend>Choose your team:</legend>")
            End If
          %>
        
        <table class="data-table" cellpadding="6">
            <tr>
                <th scope="col">
                    <b>Round</b>
                </th>
                <th scope="col">
                    <b>Team</b>
                </th>
            </tr>
            <% For Each item In Model%>
            <tr>
                <td>
                    <%=item.BracketRound %>
                </td>
                <% If item.Team IsNot Nothing Then%>
                <td>
                    <%=Html.DropDownList("Team", New SelectList(ViewData("BasketballTeams"), "TeamId", "DisplayMember", item.Team.TeamId))%>
                </td>
                <% Else%>
                <td>
                    <%=Html.DropDownList("Team", New SelectList(ViewData("BasketballTeams"), "TeamId", "DisplayMember"))%>
                </td>
                <% End If%>
                <p>
                    <%=Html.Hidden("Pick", item.PickId)%>
                </p>
            </tr>
            <% Next%>
        </table>
        <br />
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
    <% End Using%>
    <% End If%>
    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
